package boogui.db;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

public class BooguiDAO implements IBooguiDAO {
	
	private final String DRV = "oracle.jdbc.driver.OracleDriver";
	private final String URL = "jdbc:oracle:thin:jwj8508/jwj8508@112.216.253.125:1521:xe";
		
	@Override
	public Connection openDatabase() throws Exception {
			Class.forName(DRV);
			return DriverManager.getConnection(URL);
		//return null;
	}

	@Override
	public void closeDatabase(Connection c, PreparedStatement p, ResultSet r) {
		if (r != null)
			try {
				r.close();
				r = null;
			} catch (Exception e) {
			}
		if (p != null)
			try {
				p.close();
				p = null;
			} catch (Exception e) {
			}
		if (c != null)
			try {
				c.close();
				c = null;
			} catch (Exception e) {
			}
		
	}

}
